﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SABI
{
    public partial class frm0067 : Form
    {
        public frm0067()
        {
            InitializeComponent();
        }

        public frm0067(string tn, string ws)
        {
            InitializeComponent();
            TableName = tn;
            WhereStr = ws;
        }

        private void frm0067_Load(object sender, EventArgs e)
        {

        }

        public string TableName { get; set; }
        public string WhereStr { get; set; }

        private void btnClose_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void frm0067_Shown(object sender, EventArgs e)
        {
            loadDATA();
        }

        private void loadDATA()
        {
            if (TableName == "" || WhereStr == "") { return; }
            string sql = "SELECT CreateUserID, CreateDate, LastModifyUserID, LastModifyDate FROM {0} {1}";
            sql = string.Format(sql,TableName,WhereStr);
            DataTable dt = new DataTable();
            dt = FRM.GetDataTable(sql);
            if (dt.Rows.Count >0)
            {
                if (dt.Rows[0]["CreateUserID"] != null)
                {
                    txtCreateUserID.Text = dt.Rows[0]["CreateUserID"].ToString();
                    txtCreateDate.Text = string.Format("{0:dd/MM/yyyy HH:mm:ss}", dt.Rows[0]["CreateDate"]);
                    txtLastModifyUserID.Text = dt.Rows[0]["LastModifyUserID"].ToString();
                    txtLastModifyDate.Text = string.Format("{0:dd/MM/yyyy HH:mm:ss}", dt.Rows[0]["LastModifyDate"]);
                }                
            }
            else
            {
                Close();
            }
        }

    }
}
